<template>
	<div>
		<el-dialog title="Alipay退款" :visible.sync="visible" width="50%" @close="onClose">
			<el-form :model="dataForm"  ref="dataForm" label-width="100px" size="small">
				<el-form-item label="退款金额" prop="refundAmount">
					<el-input v-model="dataForm.refundAmount" placeholder="退款金额" style="width: 90%;"></el-input>
				</el-form-item>
				<el-form-item label="退款原因" prop="refundReason">
					<el-input v-model="dataForm.refundReason" placeholder="退款原因" style="width: 90%;"></el-input>
				</el-form-item>
			</el-form>
			<span slot="footer" class="dialog-footer">
				<el-button type="primary" @click="dataFormSubmit()" size="small">确定</el-button>
				<el-button @click="visible = false" size="small">取消</el-button>
        
			</span>
		</el-dialog>
	</div>
</template>

<script>
	import {alipayRefund} from '@/api/alipay/alipay.js'
	export default{
		data(){
			return {
				dataForm:{
					outTradeNo:'',
					refundAmount:'',
					refundReason:'',
				},
				visible:false,
				
			}
		},
		methods:{
			init(outTradeNo){
				this.visible=true
				this.dataForm.outTradeNo = outTradeNo
			},
			onClose(){
				this.dataForm={}
			},
			dataFormSubmit(){
				alipayRefund(this.dataForm.outTradeNo,this.dataForm.refundAmount,this.dataForm.refundReason).then(data=>{
					if(data.code=="0000"){
						this.$message.success(data.msg)
						this.visible=false
						this.$emit('refreshDataList')
					}else{
						this.$message.error(data.msg)
					}
				})
			}
		}
	}
</script>

<style>
</style>

